package com.coze.lg.cozeagent;

import com.coze.lg.cozeagent.config.CozeConfig;
import com.coze.lg.cozeagent.controller.*;
import com.coze.openapi.service.service.CozeAPI;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.io.FileOutputStream;
import java.io.FileWriter;
import java.net.Socket;
import java.util.Arrays;

@SpringBootApplication
public class CozeAgentApplication {
    public static void main(String[] args) {
        SpringApplication.run(CozeAgentApplication.class, args);
//        new AipSpeech();
//        new socketSocket(5704).start();
//        new socketWebSocketSpringBoot();
//        new socketMySocket(5704).start();

        // 这段代码单独测试 textToSpeech 的 二进制 pcm
//        try {
//            CozeAPI cozeAPI = new CozeConfig().cozeAPI();
//            AipSpeech client = new AipSpeech();
//            SessionMySocket sess = new SessionMySocket(client, cozeAPI, new Socket("127.0.0.1", 5703));
//            byte[] pcmBytes = sess.textToSpeech("小光小光，你好呀，你会什么东西？");
//            System.out.println("pcmBytes.length:" + pcmBytes.length);
//            System.out.println("start file");
//            // 使用FileOutputStream写入文件
//            FileOutputStream fileOutputStream = new FileOutputStream("Y://test.pcm");
//            fileOutputStream.write(pcmBytes);
//            fileOutputStream.close();
//            System.out.println("susses file");
//        }
//        catch (Exception e) {
//            System.out.println( e.getMessage());
//        }

    }
}
